home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tess_5.arc / TESS.TP4 < prev    next >
Text File  |  1990-08-18  |  20KB  |  426 lines

  1. {****************************************************************************
  2.  * TESS.TP4 -- constants and RECORD structures for TP4 programs
  3.  ***************************************************************************}
  4.  
  5. {*******************************< TESS.TP4 >*********************************
  6. *                                                                           *
  7. *                Turbo Pascal 4.0 Include File for TesSeRact                *
  8. *                -------------------------------------------                *
  9. *                                                                           *
  10. *   TesSeRact(TM) -- A Library of Routines for Creating Ram-Resident (TSR)  *
  11. *                    programs for the IBM PC and compatible Personal        *
  12. *                    Computers.                                             *
  13. *                                                                           *
  14. *   The software, documentation and source code are:                        *
  15. *                                                                           *
  16. *       Copyright (C) 1986, 1987, 1988 Tesseract Development Team           *
  17. *       All Rights Reserved                                                 *
  18. *                                                                           *
  19. *************************************************************************CR*}
  20.  
  21. {**
  22.      This product  supports the  TesSeRact(TM)  Standard  for  Ram-Resident
  23.      Program Communication.   For  information about TesSeRact, contact the
  24.      TesSeRact Development Team at:
  25.      
  26.           TesSeRact Development Team
  27.           c/o Chip Rabinowitz
  28.           2084 Woodlawn Avenue
  29.           Glenside, PA 19038
  30.           1-215-884-3373
  31.      
  32.           Compuserve:    70731,20
  33.           MCIMAIL:       315-5415
  34.      
  35.      This MCIMAIL  Account has  been provided  to the TesSeRact Development
  36.      Team by Borland International, Inc.  The TesSeRact Development Team is
  37.      in no  way associated with Borland International, Inc.  TesSeRact is a
  38.      trademark of the TesSeRact Development Team.
  39. **}
  40.  
  41. {**
  42. ***************************************************************************
  43.                              Copyright Notice
  44. ***************************************************************************
  45.  
  46. This  document,   other  accompanying  written  and  disk-based  notes  and
  47. specifications, and all referenced and related program files, demonstration
  48. code and  object modules  accompanying this document are copyrighted by the
  49. TesSeRact Development  Team.   The copyright  owner hereby licenses you to:
  50. use the  software; make as many copies of the software and documentation as
  51. you wish;  give exact  copies of the original to anyone; and distribute the
  52. software and  documentation in  its unmodified  form via  electronic means.
  53. There is no charge for any of the above.
  54.  
  55. You are specifically prohibited from charging, or requesting donations, for
  56. any such  copies, however made.  Exceptions may be granted to organizations
  57. which charge  a small  fee for  materials, handling,  postage  and  general
  58. overhead.  NO   ORGANIZATION  IS   AUTHORIZED  TO  CHARGE  ANY  AMOUNT  FOR
  59. DISTRIBUTION OF  THE SOFTWARE  OR DOCUMENTATION UNDER ANY OTHER CONDITIONS.
  60. Organizations which  charge a fee for distribution of any and all TesSeRact
  61. materials, except  as noted  above or  with the express, written consent of
  62. the TesSeRact  Development Team,  will be  considered in  violation of this
  63. copyright, and will be prosecuted to the full extent of the law.
  64.  
  65. In addition,  you are specifically prohibited from making any modifications
  66. to the  TesSeRact Library  Routines and/or documentation, unless you have a
  67. license for  the use  of the  source code.   Under  no circumstances is the
  68. copyright notice embedded in the TesSeRact code to be modified or removed.
  69.  
  70. This is  not free  software.   This license allows you to use this software
  71. without charge  for a period of 30 days.  In order to include this software
  72. as part  of any  product, either commercial, shareware, freeware, or public
  73. domain, registration  is required.   TesSeRact  may not  be included in any
  74. product for  any use  without registration.   Any such use of the TesSeRact
  75. product are in violation of federal copyright laws, and will be prosecuted.
  76.  
  77. No copy  of the  software may  be distributed  or given  away without  this
  78. accompanying documentation; this notice must not be removed.
  79.  
  80.  
  81. ***************************************************************************
  82.                                  Warranty
  83. ***************************************************************************
  84.  
  85. There is  no warranty  of any  kind associated  with this software, and the
  86. copyright owner  is not  liable for  damages of  any kind.   By  using this
  87. software, you  agree to  this.  Every effort has been made by the TesSeRact
  88. Development Team  to make  this product  bug-free.   However, the nature of
  89. software development  is  that  it  is  impossible  to  guarantee  bug-free
  90. software.
  91.  
  92. In the event a verifiable bug is found, the TesSeRact Development Team will
  93. make every  attempt to  repair the  bug as  soon as possible.  
  94.  
  95. ***************************************************************************
  96.                              Acknowledgements
  97. ***************************************************************************
  98.  
  99. Grateful appreciation  is expressed  to CompuServe Information Service, the
  100. IBM Software  Forums and  their Sysops, and Computer Language Magazine, for
  101. providing us  with the  means to  accomplish the  development of TesSeRact.
  102. Without their  gracious assistance,  TesSeRact could  never have  come into
  103. existence.
  104.  
  105. And let's not forget Anne Marie, who suffered through the long evenings and
  106. nights spent getting this product ready.
  107.  
  108. ***************************************************************************
  109. The TesSeRact Development Team:
  110. ***************************************************************************
  111.      
  112.      Team Leader:   Chip Rabinowitz
  113.      Developers:    Lane Ferris
  114.                     Kim Kokkonen
  115.                     Jim Kyle
  116.                     Neil J. Rubenking
  117.                     Barry Simon
  118.                     Rick Wilson
  119.      Contributors:  Thomas Brandenborg
  120.                     Chris Dunford
  121.                     John Friend
  122.                     Mark Horvatich
  123.                     John Hensley
  124.      Advisors:      Robert Bierman
  125.                     David Intersimone
  126.                     Rick Kraus
  127.                     David Moskowitz
  128.                     Gary Saxer
  129.  
  130. ***************************************************************************
  131. **}
  132.  
  133.     {* Stores interrupt vector information for TesSeRact use *}
  134. type
  135.   TsrIntTable = RECORD
  136.     OldVector      : pointer;           {* Old Interrupt Vector            *}
  137.     IntNumber      : byte;              {* Interrupt Number                *}
  138.     NewVector      : word;              {* offset of new vector            *}
  139.   END;
  140.  
  141.     {* User structure for defining additional hotkeys *}
  142. type
  143.   ExtraHot = RECORD
  144.     HotKey         : byte;              {* hotkey to check for             *}
  145.     ShiftState     : byte;              {*  shift state for this hot key   *}
  146.     FlagByte       : byte;              {*  flag value to use              *}
  147.                                         {*  MAY NOT BE ZERO!!!             *}
  148.   END;
  149.  
  150.     {* TesSeRact internal data *}
  151.  type 
  152.   TsrData = RECORD
  153.     RevLvl         : byte;              {* Revision Level of TESS Lib      *}
  154.     PopupType      : byte;              {* Type of popup in effect         *}
  155.     WasInt8        : byte;              {* An Interrupt 08h occurred       *}
  156.     WasInt13       : byte;              {* An Interrupt 13h occurred       *}
  157.     IntFlags       : byte;              {* Which interrupts are active     *}
  158.     SoftFlags      : byte;              {* Which soft ints are active      *}
  159.     DosVersion     : byte;              {* current major revision of DOS   *}
  160.     waitcount      : byte;              {* Count to wait before popping up *}
  161.     InDosFlag      : pointer;           {* Pointer to DOS INDOS flag       *}
  162.     DosCritErr     : pointer;           {* Pointer to DOS Critical Error   *}
  163.     UserPSP        : word;              {* PSP segment of user program     *}
  164.     User28PSP      : word;              {* PSP segment of user program     *}
  165.     UserDTA        : pointer;           {* DTA of interrupted program      *}
  166.     User28DTA      : pointer;           {* DTA of interrupted program      *}
  167.     UserSS         : word;              {* Stack segment of user program   *}
  168.     UserSP         : word;              {* Stack pointer of user program   *}
  169.     User28SS       : word;              {* Stack segment of user program   *}
  170.     User28SP       : word;              {* Stack pointer of user program   *}
  171.     UserInt24      : pointer;           {* pointer to use INT 24 handler   *}
  172.     SavedInt9      : pointer;           {* storage for additional INT9     *}
  173.     OldExtErr      : array[0..2] of word;
  174.                                         {* storage for old DOS 3 extended  *}
  175.                                         {*     error information           *}
  176.     OldBreak       : byte;              {* Old Break Setting               *}
  177.     OldVerify      : byte;              {* Old Verify Setting              *}
  178.     InWord4        : byte;              {* flag to indicate in WORD 4.0    *}
  179.     WasWord4       : byte;              {* word 4 special popup flag       *}
  180.     NewKbdFlag     : byte;              {* Enhanced Keyboard Call in use   *}
  181.     Word4Delay     : byte;              {* Delay for Word 4                *}
  182.  
  183.     Int8           : TsrIntTable;       {* Interrupt vector tables         *}
  184.     Int9           : TsrIntTable;
  185.     Int13          : TsrIntTable;
  186.     Int16          : TsrIntTable;
  187.     Int1C          : TsrIntTable;
  188.     Int21          : TsrIntTable;
  189.     Int28          : TsrIntTable;
  190.     Int2F          : TsrIntTable;
  191.     Int1B          : TsrIntTable;
  192.     Int23          : TsrIntTable;
  193.     Int24          : TsrIntTable;
  194.   END;
  195.  
  196.   DataPtr = ^TsrData;
  197.  
  198.     {* TesSeRact data for individual TSR *}
  199. type
  200.   TsrParms = RECORD
  201.                IdCode     : array[0..7] of char; { Unique TSR Id String }
  202.                IdNum      : word;         { Unique TSR Id Number        }
  203.                FuncFlags  : longint;      { Bit map of supported functions }
  204.                HotKey     : byte;         { Hotkey for this TSR         }
  205.                ShiftState : byte;         { ShiftState for this TSR     }
  206.                HotKeyFlag : byte;         { which hotkey is in use      }
  207.                ExtraHotCnt : byte;        {number of extra hotkeys to use }
  208.                ExtraHotKeys : pointer;    { Pointer to hotkey structures }
  209.                TsrStatus  : word;         { Current TSR Status Flags    }
  210.                TsrPSP     : word;         { TSR's PSP Segment           }
  211.                TsrDTA     : pointer;      { Pointer to TSR's DTA region }
  212.                TsrDSeg    : word;         { TSR's Default Data Segment  }
  213.                PopupStack : pointer;      { Pointer to Popup Stack Area }
  214.                BackStack  : pointer;      { Pointer to Background Stack }
  215.              END;
  216.   ParmPtr  = ^TsrParms;
  217.  
  218.  
  219. const   { for HotKeys }
  220.   TSRHOT_A   = $001e;
  221.   TSRHOT_B   = $0030;
  222.   TSRHOT_C   = $002e;
  223.   TSRHOT_D   = $0020;
  224.   TSRHOT_E   = $0012;
  225.   TSRHOT_F   = $0021;
  226.   TSRHOT_G   = $0022;
  227.   TSRHOT_H   = $0023;
  228.   TSRHOT_I   = $0017;
  229.   TSRHOT_J   = $0024;
  230.   TSRHOT_K   = $0025;
  231.   TSRHOT_L   = $0026;
  232.   TSRHOT_M   = $0032;
  233.   TSRHOT_N   = $0031;
  234.   TSRHOT_O   = $0018;
  235.   TSRHOT_P   = $0019;
  236.   TSRHOT_Q   = $0010;
  237.   TSRHOT_R   = $0013;
  238.   TSRHOT_S   = $001f;
  239.   TSRHOT_T   = $0014;
  240.   TSRHOT_U   = $0016;
  241.   TSRHOT_V   = $002f;
  242.   TSRHOT_W   = $0011;
  243.   TSRHOT_X   = $002d;
  244.   TSRHOT_Y   = $0015;
  245.   TSRHOT_Z   = $002c;
  246.   TSRHOT_0   = $000b;
  247.   TSRHOT_1   = $0002;
  248.   TSRHOT_2   = $0003;
  249.   TSRHOT_3   = $0004;
  250.   TSRHOT_4   = $0005;
  251.   TSRHOT_5   = $0006;
  252.   TSRHOT_6   = $0007;
  253.   TSRHOT_7   = $0008;
  254.   TSRHOT_8   = $0009;
  255.   TSRHOT_9   = $000a;
  256.   TSRHOT_F1  = $003b;
  257.   TSRHOT_F2  = $003c;
  258.   TSRHOT_F3  = $003d;
  259.   TSRHOT_F4  = $003e;
  260.   TSRHOT_F5  = $003f;
  261.   TSRHOT_F6  = $0040;
  262.   TSRHOT_F7  = $0041;
  263.   TSRHOT_F8  = $0042;
  264.   TSRHOT_F9  = $0043;
  265.   TSRHOT_F10 = $0044;
  266.   TSRHOT_F11 = $0057;   { not usable with all systems   }
  267.   TSRHOT_F12 = $0058;   { not usable with all systems   }
  268.  
  269.   { for ShiftState }
  270.   TSRPOPRSHIFT = $0001;
  271.   TSRPOPLSHIFT = $0002;
  272.   TSRPOPCTRL   = $0004;
  273.   TSRPOPALT    = $0008;
  274.  
  275.   { for TSRFLAGS }
  276.   TSRUSEPOPUP  = $0010;
  277.   TSRUSEBACK   = $0020;
  278.   TSRUSETIMER  = $0040;
  279.   TSRUSEUSER   = $0100;
  280.   NOPOPGRAPH   = $1000;
  281.   NOPOPCOMMAND = $2000;
  282.  
  283.   { for TsrStatus flags }
  284.   HOTKEYON     = $0001;                 {* hot key pressed                 *}
  285.   SHIFTSON     = $0002;                 {* shift states match              *}
  286.   TSRACTIVE    = $0004;                 {* tsr is running in foreground    *}
  287.   INT28ACTIVE  = $0008;                 {* INT28 routine is running        *}
  288.  
  289.   POPUPSET     = $0010;                 {* popup resident routine installed*}
  290.   BACKSET      = $0020;                 {* background routine installed    *}
  291.   TIMERSET     = $0040;                 {* timer procedure installed       *}
  292.   EXTRAHOTSET  = $0080;                 {* extra hot keys installed        *}
  293.  
  294.   USERPROCON   = $0100;                 {* User-defined procedure installed*}
  295.   TSRENABLED   = $0200;                 {* TSR currently enabled           *}
  296.   TSRRELEASED  = $0400;                 {* TSR has been released           *}
  297.   EXTRAINT24   = $0800;                 {* User installed replacement INT24*}
  298.  
  299.   { for IntFlags and SoftFlags}
  300.   ININT13      = $04;                   {* Interrupt 13 is currently active*}
  301.   ININT21      = $08;                   {* Interrupt 21 is currently active*}
  302.   ININT16      = $10;                   {* Interrupt 16 is currently active*}
  303.   ININT28      = $20;                   {* Interrupt 28 is currently active*}
  304.   ININT08      = $40;                   {* Interrupt 08 is currently active*}
  305.   ININT1C      = $80;                   {* Interrupt 1C is currently active*}
  306.  
  307.   { Keyboard Stuffing Speeds }
  308.   STUFF_SLOW   = 0;                     {* Stuff key when buffer is empty  *}
  309.   STUFF_MED    = 1;                     {* Stuff up to four keys per tick  *}
  310.   STUFF_FAST   = 2;                     {* Full buffer on every tick       *}
  311.  
  312. function TsDoInit(
  313.          HotKey,                { one of the HOTKEY constants           }
  314.          ShiftState,            { one of the ShiftState constants       }
  315.          TSRFlags,              { one of the Flags constants            }
  316.          MemoryTop : word       { amount of RAM to keep resident        }
  317.     ) : word; { returns ONLY if TesSeRact can't install; then is $FFFF }
  318.  
  319. procedure TsSetStack(
  320.     var PopUpStack,     { stack for use by PopUp routine        }
  321.         BackGroundStack { stack for use by BackGround routine   }
  322.     );
  323.  
  324. procedure TessBeep;    { calls TesSeRact's error_beep routine }
  325.  
  326. function TsCheckResident(
  327.     var IDStr,  { 8-byte-plus-nul ASCIIZ ID String for TSR              }
  328.         IDNum   { word where TSR-handle ID number will be stored        }
  329.     ) : word;   { use BEFORE DoInit; returns $FFFF if already loaded    }
  330.  
  331. function TsGetParms(
  332.     TsrIdNum : word     { TSR-handle of one to be enabled       }
  333.     ) : ParmPtr;        { NIL if IdNum invalid, else points to TsrParms }
  334.  
  335. function TsCheckHotkey(
  336.     HotKey   : word     { key scan code from constants above    }
  337.     ) : word;   { $FFFF if conflict, anything else indicates OK }
  338.  
  339. function TsSetUser24(
  340.     TsrIdNum : word;    { TSR-handle of one to be enabled       }
  341.     UserCritErrProc : pointer   { pointer to user's procedure   }
  342.     ) : integer;        { zero if successful, nonzero if not    }
  343.  
  344. function TsEnable(
  345.     TsrIdNum : word     { TSR-handle of one to be enabled       }
  346.     ) : word;   {zero means success; non-zero means invalid ID num }
  347.  
  348. function TsDisable(
  349.     TsrIdNum : word     { TSR-handle of one to be disabled      }
  350.     ) : word;   {zero means success; non-zero means invalid ID num }
  351.  
  352. function TsRelease(
  353.     TsrIdNum : word     { TSR-handle of one to be released      }
  354.     ) : word;   {zero means success; non-zero means invalid ID num }
  355.  
  356. function TsRestart(
  357.     TsrIdNum : word     { TSR-handle of one to be re-started    }
  358.     ) : word;   { zero successful, NZ if bad TSR number         }
  359.  
  360. function TsGetStat(
  361.     TsrIdNum : word     { TSR-handle of one to be checked       }
  362.     ) : word;   { returns current status-word of specified TSR  }
  363.  
  364. function TsSetStat(
  365.     TsrIdNum : word;      { TSR-handle of one to be changed       }
  366.     NewStatus : word { new status word to be plugged in    }
  367.     ) : word;   {zero means success; non-zero means invalid ID num }
  368.  
  369. function TsGetPopType(
  370.     TsrIdNum : word     { TSR-handle of one to be checked       }
  371.     ) : word;   { zero if invoked from Timer, NZ if background  }
  372.  
  373. function TsCallUserProc(
  374.     TsrIdNum : word;    { TSR-handle of one to be called        }
  375.     UserPtr  : pointer  { points to user-defined data or code   }
  376.     ) : word;   {zero means success; non-zero means invalid ID num }
  377.  
  378. function TsStuffKeyboard(
  379.     TsrIdNum : word;    { TSR-handle of one to be called        }
  380.     KbdPtr   : pointer; { points to keys to stuff into buffer   }
  381.     KbdLen   : word;    { number of keystrokes to stuff         }
  382.     Speed    : word     { 0=SLOW, 1=MEDIUM, 2=FAST              }
  383.     ) : word;   {zero means success; non-zero means invalid ID num }
  384.  
  385. function TsTriggerPop(
  386.     TsrIdNum : word     { TSR-handle of one to be checked       }
  387.     ) : word;   { always zero }
  388.  
  389. function TsTriggerBack(
  390.     TsrIdNum : word     { TSR-handle of one to be checked       }
  391.     ) : word;   { always zero }
  392.  
  393. procedure TsVerify2F;
  394.  
  395. procedure TsRestore2F;
  396.  
  397. function TsSetExtraHot(
  398.     TsrIdNum : word;    { TSR-handle of one to be called        }
  399.     Count    : byte;    { number of extra hotkeys to use        }
  400.     ExtraKeys : pointer { points to structures of extra hotkeys}
  401.     ) : word;   { zero successful, NZ if bad TSR number         }
  402.  
  403. function TsGetData(
  404.     TsrIdNum : word     { TSR-handle of one to get data         }
  405.     ) : DataPtr;        { NIL if IdNum invalid, else points to TsrData }
  406.  
  407.  
  408.  
  409. procedure TsSetAdrTP4( 
  410.     ProcAdr : pointer; 
  411.     Index : integer 
  412.     );
  413.         { This procedure exists only in the TP4 version; it is used to  }
  414.         { set the TS pointers to permit popup of your own routines.     }
  415.         { During initialization of the unit, all six pointers are set   }
  416.         { to a FAR RET within the unit; your code must reset those you  }
  417.         { want to use, via "TsSetAdrTP4( @TsrMain, 2 );" etc.  The index}
  418.         { codes to use are:                                             }
  419.         {       0 = your timer procedure, executed 18.2 times/second    }
  420.         {       1 = your background procedure, done if check is TRUE    }
  421.         {       2 = your main pop-up procedure, done when hotkey is hit }
  422.         {       3 = your background-check function, checked when safe   }
  423.         {       4 = your user-defined procedure; see TESS.H for details }
  424.         {       5 = your Initialization/Cleanup procedure; see TESS.H   }
  425.  
  426.